package Demo.Tree;

public class TreeNode {
    private int value;
    private TreeNode lNode;
    private TreeNode rNode;

    public TreeNode(int value) {
        this.value = value;
    }

    public TreeNode getlNode() {
        return lNode;
    }

    public void setlNode(TreeNode lNode) {
        this.lNode = lNode;
    }

    public TreeNode getrNode() {
        return rNode;
    }

    public void setrNode(TreeNode rNode) {
        this.rNode = rNode;
    }

    public void frontShow() {
        System.out.println(value);
        if (lNode!=null) {
            lNode.frontShow();
        }
        if (rNode!=null) {
            rNode.frontShow();
        }
    }
}
